﻿using Minecraft.Config.Csv.CsvCom;
using Minecraft.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Minecraft.Config.Csv.CsvCls
{
	public partial class Mod_MapResource
	{
		/// <summary>
		/// 资源id
		/// </summary>
		public int ResourceId_Convert
		{
			get
			{
				return int.Parse(ResourceId);
			}
		}
		/// <summary>
		/// 放置的坐标点
		/// </summary>
		public Point3 point3
		{
			get
			{
				var strs = Position.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList().ConvertAll(m => int.Parse(m));
				return new Point3
				{
					x = strs[0],
					y = strs[1],
					z = strs[2]
				};
			}
		}
		/// <summary>
		/// 半径
		/// </summary>
		public int Radius_Convert
		{
			get
			{
				return int.Parse(Radius);
			}
		}
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public List<ModTreasureBoxGuardInfo> GetModTreasureBoxGuardInfoList()
		{
			List<ModTreasureBoxGuardInfo> modTreasureBoxGuardInfoList = new List<ModTreasureBoxGuardInfo>();
			var strs = Guard.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
			foreach (var str in strs)
			{
				var items = str.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
				ModTreasureBoxGuardInfo modTreasureBoxGuardInfo = new ModTreasureBoxGuardInfo
				{
					ActorId = items[0],
					weight = Convert.ToInt32(double.Parse(items[1])),
					minCount = int.Parse(items[2]),
					maxCount = int.Parse(items[3])
				};
				modTreasureBoxGuardInfoList.Add(modTreasureBoxGuardInfo);
			}
			return modTreasureBoxGuardInfoList;
		}
	}
}
